<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Report extends CI_Controller{
	
	
	public $user_data=array();
	
	function __construct()
     {
	     parent::__construct();
	     
		//不登陆的不让访问
		if (!$this->session->userdata('uadmin_in')){
			
			redirect('admin/home');
			exit();
		}
		
		$this->user_data["uadmin_name"] = $this->session->userdata('uadmin_name');
		$this->user_data["uadmin_userid"] = $this->session->userdata('uadmin_userid');
		$this->user_data["uadmin_account"] = $this->session->userdata('uadmin_account');
		
		$this->load->model('Report_model');
     }
	
	//统计浏览记录
	public function VisitorsReport()
	{
		$data=array();
		$data["title"]="Visitors Report";
		$data["sadmin_account"] = $this->session->userdata('uadmin_account');
		if($data["sadmin_account"] == "root")
		{
			$data["AgenctOptions"] = $this->Report_model->get_Angcy_DropdownlistOption();
		}
		$this->load->view("admin/report/visitors_report",$data);
	}
	//统计浏览记录
	public function querryVisitorsReport()
	{
		$data=array();
		
		$this->load->model("Report_model");
		
		$data["title"]	="query Visitors Report";
		$data["result"] =$this->Report_model->query_visits_report($_POST);
		$data["Agency"] = $_POST["AgenctCode"];
		
		$this->load->view("admin/report/query_visitors_report",$data);
	}
	//统计浏览记录详细
	public function querryVisitorsReportDetails()
	{
		$data=array();
		
		$this->load->model("Report_model");
		
		$data["title"]	="query Visitors Report";
		$data["result"]=$this->Report_model->query_visits_report_detail($_GET);
		
		$this->load->view("admin/report/query_visitors_report_details",$data);
	}
	
	//统计订单
	public function OrdersReport()
	{
		$data=array();
		$data["title"]="Order Report";
		$data["BeginDate"]=date("Y-m-d",strtotime("-7 day"));
		$data["EndDate"]=date("Y-m-d");
		$data["sadmin_account"] = $this->session->userdata('uadmin_account');
		if($data["sadmin_account"] == "root")
		{
			$data["AgenctOptions"] = $this->Report_model->get_Angcy_DropdownlistOption();
		}
		$this->load->view("admin/report/orders_report",$data);
	}
	//统计订单
	public function querryOrdersReport()
	{
		$data=array();
		
		$this->load->model("Report_model");
		
		$data["title"]	="query Orders Report";
		$data["result"]=$this->Report_model->query_orders_report($_POST);
		
		$this->load->view("admin/report/query_orders_report",$data);
	}
	
	//-IBE使用报表
	public function vIBE_used_report()
	{
		$data=array();
		$data["title"]="vIBE Used Report";
		$data["sadmin_account"] = $this->session->userdata('uadmin_account');
		if($data["sadmin_account"] == "root")
		{
			$data["AgenctOptions"] = $this->Report_model->get_Angcy_DropdownlistOption();
		}

		$this->load->view("admin/report/vIBE_used_report.php",$data);
	}
	//IBE使用报表
	public function querry_vIBE_used_report()
	{
		$data["title"]	="query vIBE used report";
		$data["result"]=$this->Report_model->querry_vIBE_used_report($_POST);
		
	  	$this->load->view("admin/report/query_vIBE_used_report.php",$data);
	}
}
?>